package org.dfg.corejava.jdk8.lumbda;

import java.util.Comparator;

public class Lumbda1 {
	// 函数接口,又叫功能性接口，即只有一个方法的接口。lambda表达式就是基于函数接口实现的
	@FunctionalInterface
	interface FunI {
		void m(int i);
		// void a();添加注解，防止其他人员误加其它方法
	}

	public static void main(String[] args) {
		Runnable a = () -> {
			System.out.println("haha");
		};
		new Thread(a).start();

		new Thread(() -> {
			System.out.println("run");
		});

		Comparator<String> c = (String s1, String s2) -> {
			return s1.length() - s2.length();
		};
		System.out.println(c.compare("abc", "a"));

		FunI ii = (int i) -> {
			System.out.println(i);
		};
		ii.m(4);
	}

}
